/*
 * 文件名：StsArCollectJob.java
 * 版权：Copyright by www.infopub.top
 * 描述：
 * 修改人：wuzhiyang
 * 修改时间：2020年3月20日
 * 跟踪单号：
 * 修改单号：
 * 修改内容：
 */

package top.infopub.job.quartz.exec;


import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import top.infopub.job.hr.service.INCtoPMService;
import top.infopub.job.hr.service.INcOrginfoService;
import top.infopub.job.hr.service.INcStaffinfoService;
import top.infopub.job.hr.service.impl.NcOrginfoServiceImpl;
import top.infopub.job.quartz.exec.base.BaseJob;
import top.infopub.util.DateUtil;
import top.infopub.util.SpringContext;

import java.util.Map;


/**
 * Nc初始化
 */
public class NcOrginfoJob extends BaseJob {

    private static INcOrginfoService ncOrginfoService;

    static {
        ncOrginfoService = SpringContext.getBean(INcOrginfoService.class);
    }
    private static INcStaffinfoService iNcStaffinfoService;

    static {
        iNcStaffinfoService = SpringContext.getBean(INcStaffinfoService.class);
    }

    private static INCtoPMService nctoPMService;

    static {
        nctoPMService = SpringContext.getBean(INCtoPMService.class);
    }

    public NcOrginfoJob() {}

    @Override
    public void execute(JobExecutionContext arg0)
        throws JobExecutionException {
        try {
            String start = DateUtil.currentDateDef();
            log.info("首次初始化NC开始123：{}", start);
            ncOrginfoService.initNcOrgInfoTEMP();
            iNcStaffinfoService.initNcstaffInfoTEMP();

            Map map = nctoPMService.initOrgData20210106();
            nctoPMService.initUserData20210106(map);
            String end = DateUtil.currentDateDef();
            log.info("首次初始化NC结束456：{}", end);
            logSucceed("首次初始化NC，开始时间：" + start + "，结束时间：" + end);
        }
        catch (Exception e) {
            log.error("首次初始化NC error", e);
            logFail(e, true);
        }

    }

}
